package com.cloudsigns.factorymanager2.engineering.fragment;

import android.content.Intent;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;

import com.baidu.mapapi.map.BaiduMap;
import com.baidu.mapapi.map.BitmapDescriptor;
import com.baidu.mapapi.map.BitmapDescriptorFactory;
import com.baidu.mapapi.map.MapStatus;
import com.baidu.mapapi.map.MapStatusUpdateFactory;
import com.baidu.mapapi.map.MapView;
import com.baidu.mapapi.map.Marker;
import com.baidu.mapapi.map.MarkerOptions;
import com.baidu.mapapi.map.OverlayOptions;
import com.baidu.mapapi.model.LatLng;
import com.cloudsigns.factorymanager2.R;
import com.cloudsigns.factorymanager2.cusenum.CommonEnum;
import com.cloudsigns.factorymanager2.engineering.IView.InEngineeringOrderListForMapView;
import com.cloudsigns.factorymanager2.engineering.IView.InRegionListView;
import com.cloudsigns.factorymanager2.engineering.activity.EngineeringInstallFeedBackForWaitStateActivity;
import com.cloudsigns.factorymanager2.engineering.activity.EngineeringInstallOrderForSuperActivity;
import com.cloudsigns.factorymanager2.engineering.activity.EngineeringMainForSuperActivity;
import com.cloudsigns.factorymanager2.engineering.activity.RegionMapForSuperActivity;
import com.cloudsigns.factorymanager2.engineering.bean.OrderParentBean;
import com.cloudsigns.factorymanager2.engineering.bean.RegionBean;
import com.cloudsigns.factorymanager2.engineering.customview.BottomDialog;
import com.cloudsigns.factorymanager2.engineering.presenter.EngineeringOrderListForMapPresenter;
import com.cloudsigns.factorymanager2.engineering.presenter.RegionListPresenter;
import com.cloudsigns.factorymanager2.project.utils.ConstantUtil;
import com.cloudsigns.factorymanager2.service.LocationService;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by tony on 2018/5/3.
 */

public class MapForSuperFragment extends Fragment implements BottomDialog.OnBottomDialogClick, InEngineeringOrderListForMapView, InRegionListView {
    private final String TAG = MapForSuperFragment.class.getSimpleName();
    private MapView bmapView;
    private BaiduMap mBaiduMap;
    private LocationService locService;
    private EngineeringOrderListForMapPresenter engineeringOrderListForMapPresenter;
    private List<OrderParentBean> intellegenteOrderList;
    private List<OrderParentBean> engineeringManagementOrderList;
    //    private List<ProduceOrderParentBean> maintenanceOrderList;
    private RegionListPresenter regionListPresenter;
    List<RegionBean> regionBeanList;
    private int currentType = -1;
//    private List<Double> latList;
//    private List<Double> lonList;


    @Override
    public void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    @Nullable
    @Override
    public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
        View view = inflater.inflate(R.layout.fragment_map_for_super, container, false);

        //获取地图控件引用
        bmapView = view.findViewById(R.id.bmapView);
        //不显示缩放控件
        bmapView.showZoomControls(false);

         /*获取地图对象*/
        mBaiduMap = bmapView.getMap();

//        latList = new ArrayList<>();
//        latList.add(43.88);
//        latList.add(43.87);
//        latList.add(44.45);
//        latList.add(44.52);
//        latList.add(44.83);
//        latList.add(44.15);
//        latList.add(43.53);
//        latList.add(43.87);
//        latList.add(44.4);
//        latList.add(43.75);
//        latList.add(42.97);
//        latList.add(42.93);
//        latList.add(42.93);
//        latList.add(43.32);
//        latList.add(42.85);
//        latList.add(42.98);
//
//        lonList = new ArrayList<>();
//        lonList.add(125.35);
//        lonList.add(126.57);
//        lonList.add(125.15);
//        lonList.add(125.68);
//        lonList.add(126.55);
//        lonList.add(126.83);
//        lonList.add(125.68);
//        lonList.add(126.57);
//        lonList.add(126.97);
//        lonList.add(127.33);
//        lonList.add(126.72);
//        lonList.add(126.03);
//        lonList.add(129.52);
//        lonList.add(129.75);
//        lonList.add(130.35);
//        lonList.add(129.83);

        //        float zoom = 5.0f;
//        double latDefault = 43.88;
//        double lngDefault = 125.25;
//        resetMapView(11.0f,43.88,125.25);
//        resetMapView(5.0f,39.945,116.404);
        resetMapView();
        mBaiduMap.setOnMarkerClickListener(onMarkerClickListener);


        engineeringOrderListForMapPresenter = new EngineeringOrderListForMapPresenter(this);
        regionListPresenter = new RegionListPresenter(this);

        return view;
    }

    /*设置地图默认显示坐标点和缩放级别*/
    private void resetMapView() {
        int zoom = 5;
        double latDefault = 34.0;
        double lngDefault = 108.0;

        try {
            if (mBaiduMap != null) {
                mBaiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(new MapStatus.Builder().target(new LatLng(latDefault, lngDefault)).zoom(zoom).build()));
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

//
//    /*设置地图默认显示坐标点和缩放级别*/
//    private void resetMapView(float zoom,double lat,double lng) {
////        float zoom = 5.0f;
////        double latDefault = 43.88;
////        double lngDefault = 125.25;
//
//        try {
//            if (mBaiduMap != null) {
//                mBaiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(new MapStatus.Builder().target(new LatLng(lat, lng)).zoom(zoom).build()));
//            }
//        } catch (Exception e) {
//            e.printStackTrace();
//        }
//    }


    public void getOrderList(int engineeringType) {
        resetMapView();
//        if (currentType == engineeringType) {
//            return;
//        } else {

        currentType = engineeringType;
        mBaiduMap.clear();

//        if (currentType == EngineeringMainForSuperActivity.INTELLIGENT)    //智能控制

        if (currentType == EngineeringMainForSuperActivity.MAINTENANCE)   //媒体运维
            regionListPresenter.getMediaRegionList();

        if (currentType == EngineeringMainForSuperActivity.ENGINEERING)  //工程管理
            engineeringOrderListForMapPresenter.getEngineeringOrderList();

//        }

    }

    private void updataMap() {
        if (currentType == EngineeringMainForSuperActivity.INTELLIGENT) {  //智能控制
            if (null != intellegenteOrderList)
                addMarker(intellegenteOrderList);
        } else if (currentType == EngineeringMainForSuperActivity.MAINTENANCE) { //媒体运维
//            if (null != maintenanceOrderList)
//                addMarker(maintenanceOrderList);
            if (null != regionBeanList)
                addRegionMarker(regionBeanList);

        } else if (currentType == EngineeringMainForSuperActivity.ENGINEERING) { //工程管理
            if (null != engineeringManagementOrderList)
                addMarker(engineeringManagementOrderList);
        }
    }

    /*往地图添加一个点*/

    private void addMarker(List<OrderParentBean> orderParentBeanList) {
        //
//        Glide.with(this).load(R.mipmap.icon_map_status_red).asBitmap().into(new SimpleTarget<Bitmap>() {
//            @Override
//            public void onResourceReady(Bitmap resource, GlideAnimation<? super Bitmap> glideAnimation) {
//                LatLng point = new LatLng(43.88, 125.25);
//                BitmapDescriptor bitmapDescriptor = BitmapDescriptorFactory
//                        .fromBitmap(resource);
//                OverlayOptions option = new MarkerOptions()
//                        .position(point)
//                        .icon(bitmapDescriptor);
//                mBaiduMap.addOverlay(option);
//            }
//        });

        //创建OverlayOptions的集合

        List<OverlayOptions> options = new ArrayList<OverlayOptions>();
        //构建Marker图标
        BitmapDescriptor bitmap_exception = null;
        BitmapDescriptor bitmap_wait_confirm = null;
        BitmapDescriptor bitmap_working = null;
        BitmapDescriptor bitmap_complete = null;
        BitmapDescriptor bitmap_out_plan = null;
        BitmapDescriptor bitmap_no_feedback = null;
        BitmapDescriptor bitmap_pause = null;

        LatLng point;
        Bundle bundle = null;
        String title = "";
        BitmapDescriptor bitmap = null;


        for (int i = 0; i < orderParentBeanList.size(); i++) {

            bitmap = null;

            OrderParentBean orderParentBean = orderParentBeanList.get(i);

            bundle = new Bundle();
            bundle.putSerializable(ConstantUtil.KEY_1, orderParentBean);

            CommonEnum.EngineeringORderCategory oRderCategory = orderParentBean.getCategory();
            if (null != oRderCategory) {
                if (oRderCategory == CommonEnum.EngineeringORderCategory.INSTALL) {
                    title = "工程安装";
                } else if (oRderCategory == CommonEnum.EngineeringORderCategory.BATCH_INSTALL) {
                    title = "批量工程";
                } else if (oRderCategory == CommonEnum.EngineeringORderCategory.CONSTRUCT) {
                    title = "施工";
                } else if (oRderCategory == CommonEnum.EngineeringORderCategory.MAINTAIN) {
                    title = "维修";
                } else if (oRderCategory == CommonEnum.EngineeringORderCategory.PUBLICATION) {
                    title = "上刊";
                    ;
                } else if (oRderCategory == CommonEnum.EngineeringORderCategory.PATROL) {
                    title = "巡查";
                }else if (oRderCategory == CommonEnum.EngineeringORderCategory.SURVEY) {
                    title = "现场勘察";
                }
            }

//            //设置坐标点
//            int j = i % 16;
//            point = new LatLng(latList.get(j), lonList.get(j));
            point = new LatLng(orderParentBean.getLat(), orderParentBean.getLon());


            OverlayOptions option = null;

            CommonEnum.FeedBackState feedBackState = orderParentBean.getFeedBackState();

            if (CommonEnum.FeedBackState.EXCEPTION == feedBackState) {
                if (null == bitmap_exception) {
                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.icon_map_2);

                    //构建Marker图标
                    bitmap_exception = BitmapDescriptorFactory
                            .fromBitmap(tmpBitmap);
                }

                bitmap = bitmap_exception;

//                //在地图上添加Marker，并显示
//                mBaiduMap.addOverlay(option);


            } else if (CommonEnum.FeedBackState.WAIT_CONFIRM == feedBackState) {
                if (null == bitmap_wait_confirm) {
                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.icon_map_1);
                    //构建Marker图标
                    bitmap_wait_confirm = BitmapDescriptorFactory
                            .fromBitmap(tmpBitmap);
                }

                bitmap = bitmap_wait_confirm;

//                //在地图上添加Marker，并显示
//                mBaiduMap.addOverlay(option);
            } else if (CommonEnum.FeedBackState.WORKING == feedBackState) {
                if (null == bitmap_working) {
                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.icon_map_3);
                    //构建Marker图标
                    bitmap_working = BitmapDescriptorFactory
                            .fromBitmap(tmpBitmap);
                }
                bitmap = bitmap_working;

//                //在地图上添加Marker，并显示
//                mBaiduMap.addOverlay(option);
            } else if (CommonEnum.FeedBackState.COMPLETE == feedBackState) {
                if (null == bitmap_complete) {
                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.icon_map_7);
                    //构建Marker图标
                    bitmap_complete = BitmapDescriptorFactory
                            .fromBitmap(tmpBitmap);
                }
                bitmap = bitmap_complete;

//                //在地图上添加Marker，并显示
//                mBaiduMap.addOverlay(option);
            } else if (CommonEnum.FeedBackState.OUT_OF_PLAN == feedBackState) {
                if (null == bitmap_out_plan) {
                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.icon_map_4);
                    //构建Marker图标
                    bitmap_out_plan = BitmapDescriptorFactory
                            .fromBitmap(tmpBitmap);
                }
                bitmap = bitmap_out_plan;

//                //在地图上添加Marker，并显示
//                mBaiduMap.addOverlay(option);
            } else if (CommonEnum.FeedBackState.NO_FEEDBACK == feedBackState) {
                if (null == bitmap_no_feedback) {
                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.icon_map_5);
                    //构建Marker图标
                    bitmap_no_feedback = BitmapDescriptorFactory
                            .fromBitmap(tmpBitmap);
                }
                bitmap = bitmap_no_feedback;

//                //在地图上添加Marker，并显示
//                mBaiduMap.addOverlay(option);
            } else if (CommonEnum.FeedBackState.PAUSE == feedBackState) {
                if (null == bitmap_pause) {
                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.icon_map_6);
                    //构建Marker图标
                    bitmap_pause = BitmapDescriptorFactory
                            .fromBitmap(tmpBitmap);
                }
                bitmap = bitmap_pause;

//                //在地图上添加Marker，并显示
//                mBaiduMap.addOverlay(option);
            } else if (CommonEnum.FeedBackState.CREATE == feedBackState) {
                if (null == bitmap_pause) {
                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.icon_map_8);
                    //构建Marker图标
                    bitmap_pause = BitmapDescriptorFactory
                            .fromBitmap(tmpBitmap);
                }
                bitmap = bitmap_pause;

//                //在地图上添加Marker，并显示
//                mBaiduMap.addOverlay(option);
            }

//            if (CommonEnum.FeedBackState.EXCEPTION == feedBackState) {
//                if (null == bitmap_exception) {
//                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.icon_map_status_red);
//
//                    //构建Marker图标
//                    bitmap_exception = BitmapDescriptorFactory
//                            .fromBitmap(tmpBitmap);
//                }
//
//                bitmap = bitmap_exception;
//
////                //在地图上添加Marker，并显示
////                mBaiduMap.addOverlay(option);
//
//
//            } else if (CommonEnum.FeedBackState.WAIT_CONFIRM == feedBackState) {
//                if (null == bitmap_wait_confirm) {
//                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.icon_map_status_yellow);
//                    //构建Marker图标
//                    bitmap_wait_confirm = BitmapDescriptorFactory
//                            .fromBitmap(tmpBitmap);
//                }
//
//                bitmap = bitmap_wait_confirm;
//
////                //在地图上添加Marker，并显示
////                mBaiduMap.addOverlay(option);
//            } else if (CommonEnum.FeedBackState.WORKING == feedBackState) {
//                if (null == bitmap_working) {
//                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.icon_map_status_blue);
//                    //构建Marker图标
//                    bitmap_working = BitmapDescriptorFactory
//                            .fromBitmap(tmpBitmap);
//                }
//                bitmap = bitmap_working;
//
////                //在地图上添加Marker，并显示
////                mBaiduMap.addOverlay(option);
//            } else if (CommonEnum.FeedBackState.COMPLETE == feedBackState) {
//                if (null == bitmap_complete) {
//                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.icon_map_status_green);
//                    //构建Marker图标
//                    bitmap_complete = BitmapDescriptorFactory
//                            .fromBitmap(tmpBitmap);
//                }
//                bitmap = bitmap_complete;
//
////                //在地图上添加Marker，并显示
////                mBaiduMap.addOverlay(option);
//            } else if (CommonEnum.FeedBackState.OUT_OF_PLAN == feedBackState) {
//                if (null == bitmap_out_plan) {
//                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.icon_map_status_red);
//                    //构建Marker图标
//                    bitmap_out_plan = BitmapDescriptorFactory
//                            .fromBitmap(tmpBitmap);
//                }
//                bitmap = bitmap_out_plan;
//
////                //在地图上添加Marker，并显示
////                mBaiduMap.addOverlay(option);
//            } else if (CommonEnum.FeedBackState.NO_FEEDBACK == feedBackState) {
//                if (null == bitmap_no_feedback) {
//                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.icon_map_status_grag);
//                    //构建Marker图标
//                    bitmap_no_feedback = BitmapDescriptorFactory
//                            .fromBitmap(tmpBitmap);
//                }
//                bitmap = bitmap_no_feedback;
//
////                //在地图上添加Marker，并显示
////                mBaiduMap.addOverlay(option);
//            } else if (CommonEnum.FeedBackState.PAUSE == feedBackState) {
//                if (null == bitmap_pause) {
//                    Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.mipmap.icon_map_zise);
//                    //构建Marker图标
//                    bitmap_pause = BitmapDescriptorFactory
//                            .fromBitmap(tmpBitmap);
//                }
//                bitmap = bitmap_pause;
//
////                //在地图上添加Marker，并显示
////                mBaiduMap.addOverlay(option);
//            }


            //创建OverlayOptions属性
            if (null != bitmap)
                option = new MarkerOptions()
                        .position(point)
                        .extraInfo(bundle)
                        .icon(bitmap).perspective(true)
                        .title(title);
//                        .animateType(MarkerOptions.MarkerAnimateType.drop);//从天而降的方式
            //.animateType(MarkerOptions.MarkerAnimateType.grow)//从地生长的方式;


            //将OverlayOptions添加到list
            if (null != option)
                options.add(option);


        }


        //在地图上批量添加
        mBaiduMap.addOverlays(options);

    }

    private void addRegionMarker(List<RegionBean> regionBeanList) {
        if (null != regionBeanList) {
            //创建OverlayOptions的集合
            List<OverlayOptions> options = new ArrayList<OverlayOptions>();

            for (int i = 0; i < regionBeanList.size(); i++) {

                RegionBean regionBean = regionBeanList.get(i);

                //设置坐标点
//                int j = i % 16;
//                LatLng point = new LatLng(latList.get(j), lonList.get(j));
                LatLng point = new LatLng(regionBean.getLat(), regionBean.getLon());
                String title = regionBean.getRegionName();
                Bundle bundle = new Bundle();
                bundle.putSerializable(ConstantUtil.KEY_1, regionBean);

                Bitmap tmpBitmap = BitmapFactory.decodeResource(this.getContext().getResources(), R.drawable.icon_map_status_blue);
                //构建Marker图标
                BitmapDescriptor bitmap = BitmapDescriptorFactory
                        .fromBitmap(tmpBitmap);


                OverlayOptions option = new MarkerOptions()
                        .position(point)
                        .title(title)
                        .extraInfo(bundle)
                        .icon(bitmap);

                options.add(option);
            }

            //在地图上批量添加
            mBaiduMap.addOverlays(options);
        }
    }


    BaiduMap.OnMarkerClickListener onMarkerClickListener = new BaiduMap.OnMarkerClickListener() {
        @Override
        public boolean onMarkerClick(final Marker marker) {
            Bundle bundle = marker.getExtraInfo();
            if (null != bundle) {
                if (currentType == EngineeringMainForSuperActivity.INTELLIGENT) {  //智能控制

                } else if (currentType == EngineeringMainForSuperActivity.MAINTENANCE) { //媒体运维
                    RegionBean regionBean = (RegionBean) bundle.getSerializable(ConstantUtil.KEY_1);
                    Intent mIntent = new Intent(getActivity(), RegionMapForSuperActivity.class);
                    mIntent.putExtra(ConstantUtil.KEY_1, regionBean);
                    startActivity(mIntent);

                } else if (currentType == EngineeringMainForSuperActivity.ENGINEERING) { //工程管理

                    OrderParentBean orderParentBean = (OrderParentBean) bundle.getSerializable(ConstantUtil.KEY_1);
                    selectEngineering(orderParentBean.getLat(), orderParentBean.getLon());

                    BottomDialog dialog = new BottomDialog(getActivity(), orderParentBean);
                    dialog.setBottomDialogClick(MapForSuperFragment.this);
                    dialog.show();
                }


            }


            return false;
        }
    };


    /*选择一个工程后设置以该项目为中心的地图显示*/
    public void selectEngineering(double lat, double lng) {

        LatLng latLng = new LatLng(lat, lng);
        if (mBaiduMap != null) {
            mBaiduMap.setMapStatus(MapStatusUpdateFactory.newMapStatus(new MapStatus.Builder().zoom(17).target(latLng).build()));
        }
    }

    @Override
    public void onDialogClick(OrderParentBean orderParentBean) {
        if (null != orderParentBean) {
            CommonEnum.FeedBackState feedBackState = orderParentBean.getFeedBackState();
            Intent mIntent;
            if (CommonEnum.FeedBackState.EXCEPTION == feedBackState) {
                mIntent = new Intent(getActivity(), EngineeringInstallFeedBackForWaitStateActivity.class);
//                        mIntent = new Intent(getActivity(), EngineeringFeedBackForExceptionStateActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, orderParentBean);
                mIntent.putExtra(ConstantUtil.KEY_2, TAG);
                startActivity(mIntent);

            } else if (CommonEnum.FeedBackState.WAIT_CONFIRM == feedBackState) {
                mIntent = new Intent(getActivity(), EngineeringInstallFeedBackForWaitStateActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, orderParentBean);
                mIntent.putExtra(ConstantUtil.KEY_2, TAG);
                startActivityForResult(mIntent, ConstantUtil.START_ACTIVITY_KEY_1);

            } else if (CommonEnum.FeedBackState.WORKING == feedBackState) {
                mIntent = new Intent(getActivity(), EngineeringInstallFeedBackForWaitStateActivity.class);
//                        mIntent = new Intent(getActivity(), EngineeringFeedBackForWorkingStateActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, orderParentBean);
                mIntent.putExtra(ConstantUtil.KEY_2, TAG);
                startActivity(mIntent);

            } else if (CommonEnum.FeedBackState.COMPLETE == feedBackState) {
                mIntent = new Intent(getActivity(), EngineeringInstallFeedBackForWaitStateActivity.class);
//                        mIntent = new Intent(getActivity(), EngineeringFeedBackForCompletionStateActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, orderParentBean);
                mIntent.putExtra(ConstantUtil.KEY_2, TAG);
                startActivity(mIntent);


            } else if (CommonEnum.FeedBackState.OUT_OF_PLAN == feedBackState) {
                mIntent = new Intent(getActivity(), EngineeringInstallFeedBackForWaitStateActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, orderParentBean);
                mIntent.putExtra(ConstantUtil.KEY_2, TAG);
                startActivityForResult(mIntent, ConstantUtil.START_ACTIVITY_KEY_1);

            } else if (CommonEnum.FeedBackState.NO_FEEDBACK == feedBackState) {
                mIntent = new Intent(getActivity(), EngineeringInstallFeedBackForWaitStateActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, orderParentBean);
                mIntent.putExtra(ConstantUtil.KEY_2, TAG);
                startActivityForResult(mIntent, ConstantUtil.START_ACTIVITY_KEY_1);

            } else if (CommonEnum.FeedBackState.PAUSE == feedBackState) {
                mIntent = new Intent(getActivity(), EngineeringInstallFeedBackForWaitStateActivity.class);
//                        mIntent = new Intent(getActivity(), EngineeringFeedBackForPauseStateActivity.class);
                mIntent.putExtra(ConstantUtil.KEY_1, orderParentBean);
                mIntent.putExtra(ConstantUtil.KEY_2, TAG);
                startActivity(mIntent);
            }
//            Intent mIntent = new Intent(getActivity(), EngineeringInstallOrderForSuperActivity.class);
//            mIntent.putExtra(ConstantUtil.KEY_1, orderParentBean);
//            startActivity(mIntent);
        }

    }

    @Override
    public void onResume() {
        super.onResume();
        //在activity执行onResume时执行mMapView. onResume ()，实现地图生命周期管理
        bmapView.onResume();
    }

    @Override
    public void onPause() {
        super.onPause();
        //在activity执行onPause时执行mMapView. onPause ()，实现地图生命周期管理
        bmapView.onPause();
    }

    @Override
    public void onStop() {
        super.onStop();
    }

    @Override
    public void onDestroy() {
        //在activity执行onDestroy时执行mMapView.onDestroy()，实现地图生命周期管理
        bmapView.onDestroy();
        super.onDestroy();


    }

    @Override
    public void getEngineeringOrderListForMapFailed(String desc) {

    }

    @Override
    public void getEngineeringOrderListForMapSuccessed(List<OrderParentBean> allOrderList, List<OrderParentBean> maintenaceOrderList, List<OrderParentBean> engineeringManagerorderList) {
//        this.maintenanceOrderList = maintenaceOrderList;
        this.engineeringManagementOrderList = engineeringManagerorderList;
        updataMap();
    }

    @Override
    public void getMediaRegionListSuccessed(List<RegionBean> regionList) {
        regionBeanList = regionList;
        updataMap();
    }

    @Override
    public void showFailedError(String desc) {

    }

    @Override
    public void showLoading() {

    }

    @Override
    public void hideLoading() {

    }

}
